var str =`
[sysConfig]
cidFile = A2E_MU.cid
sntpServer = 192.168.0.2

[PARAM_TEMP]
external_temp_coeff_TG56 = 22
external_temp_coeff_TG40 = 254
external_temp_coeff_TG24 = 241
external_temp_coeff_TL24 = 245
Eexternal_temp_coeff_TL8 = 0
external_temp_coeff_TLMinus8 = 30
external_temp_coeff_TLMinus24 = 8
external_temp_coeff_TLMinus40 = 0
internal_temp_coeff_TG24 = 253
internal_temp_coeff_TLMinus24 = 0
stream1_coarse_cal1 = 0
stream2_coarse_cal1 = 0
stream1_coarse_cal2 = 1
stream2_coarse_cal2 = 1
stream1_fine_cal = 14360
stream2_fine_cal = 13387
Uout_offset_1 = 0
Uout_offset_2 = 0
LS_Correction_coefficient = 248
LS_Correction_bias = 26311
interchange_coef1 = 3
interchange_coef2 = 2
external_temp_coeff_TL8 = 5

[PARAM_ALARM]
lowest_external_temp_MR_threshold = 58496
highest_external_temp_MR_threshold = 9600
lowest_electronics_temp_MR_threshold = 58496
highest_electronics_temp_MR_threshold = 9856
time_delay_to_set_external_temp_MR = 32
time_delay_to_release_external_temp_MR = 4
time_delay_to_set_electronics_temp_MR =1
time_delay_to_release_electronics_temp_MR = 4
time_delay_to_set_low_light_alarm = 83
time_delay_to_release_low_light_alarm = 65535
time_delay_to_set_P6V_low_DI_alarm = 16
time_delay_to_release_P6V_low_DI_alarm = 65535
time_delay_to_set_N6V_low_DI_alarm = 16
time_delay_to_release_N6V_low_DI_alarm = 65535
DI_and_MR_threshold_for_low_P6V_level = 1
DI_and_MR_threshold_for_low_N6V_level = 65535
threshold_for_modulator_health = 12000
threshold_for_modulator_amplitude = 2500
TEC_threshold = 65535
time_delay_to_set_TEC_MR_alarm =0

threshold_for_overdriving_modulator_servo = 4200
threshold_for_modulator_locked = 65535
threshold_for_underdriving_modulator_servo = 4200
threshold_for_modulator_phase = 65535
time_delay_to_set_failed_modulator_DI_alarm = 40
time_delay_to_release_failed_modulator_DI_alarm = 65535
DI_threshold_for_VS1_too_low = 32769
DI_threshold_for_VS1_too_high = 38000
time_delay_to_set_VS1_out_of_range_DI_alarm = 100
time_delay_to_release_VS1_out_of_range_DI_alarm = 10
time_delay_to_set_OTR_DI_alarm = 65535
time_delay_to_release_OTR_DI_alarm = 65535
time_delay_to_set_PD_alarm = 50
time_delay_to_release_PD_alarm = 1000
DI_threshold_for_PD_unstable = 2000
DI_threshold_for_low_light_level = 18000
I_GUI_Modulator_A7 = 65535
I_GUI_Modulator_A8 = 32768
[PARAM_FILTER]
freq_response_HPF_1A = 23
freq_response_HPF_1B = 3
freq_response_LPF_1C = 5
freq_response_LPF_1D = 5
freq_response_HPF_2A = 5
freq_response_HPF_2B = 241
freq_response_LPF_2C = 5
freq_response_LPF_2D = 3

HPF__F1A_bypass = 1
HPF__F1B_bypass = 1
HPF__F2A_bypass = 1
HPF__F2B_bypass = 1
LPF__F1C_bypass = 0
LPF__F1D_bypass = 0
LPF__F2C_bypass = 1
LPF__F2D_bypass = 1
BPF__F1E_bypass = 1
BPF__F2E_bypass = 1
BPF__F1F_bypass = 0
BPF__F2F_bypass = 1
BPF__50_bypass = 0
BPF__300_bypass = 0
BPF__600_bypass = 0
BPF__1200_bypass = 0
BPF__1800_bypass = 0
BPF__50_en_bypass = 1
BPF__300_en_bypass = 1
BPF__600_en_bypass = 1
BPF__1200_en_bypass = 0
BPF__1800_en_bypass = 0
BPF__F1E_en_bypass = 0
BPF__F2E_en_bypass = 0
stream1_delay = 0
stream2_delay = 0
DS_50k_delay = 0
DS_4_8K_delay = 0
stream1_down_sample_rate = 25
stream2_down_sample_rate = 25
DS_50k_rate = 50
DS_4_8K_rate = 520
stream1_gain_control = 6400
stream2_gain_control = 65535
sream1_select = 0
sream2_select = 0
BPF_Delay_D1 = 0
BPF_Delay_D2 = 0
BPF_Delay_D3 = 0
BPF_Delay_D4 = 0
hold_para = 255
drop_deci_lpf1 = 4
drop_deci_lpf2 = 6
threshold1 = 30
threshold2 = 20
threshold3 = 50
force_50bpf = 0
offset3 = 0
L3 = 8
M3 = 0
ftc3 = 32538

[PARAM_CONFIG]
mod_delay_set = 60
PD_offset_subtraction = 346
V6_target_value = 200
target_value = 28500
V2 = 1
V4 = 0
V6 = 0
V2Q = 0
mod_polarity_invert = 0
zero_on_alarm = 0
digital_polarity_invert = 0
DAC_polarity_invert = 0
time_delay_to_set_mod_control=1
time_delay_to_release_mod_control=0
time_delay_to_set_AD_overflow = 2
time_delay_to_release_AD_overflow = 0
time_delay_to_set_merge = 1
time_delay_to_release_merge=6
time_delay_to_set_power_on=6
time_delay_to_release_power_on=9
LS_bits_drop = 5
LS_driver_limit = 40000
LS_Freeze = 0
LS_Zero_ind = 0
mod_depth_adjust=3
merge_HPF_Bypass = 1
modulator_freeze = 0
merge_HPF_dropN = 20
VS1_LPF_Bypass = 0
VS1_LPF_DropN = 8
derivative_merge_freeze_tdown = 2
derivative_merge_N_delay = 7
sets_time_constant_of_texternal_filter = 9
sets_time_constant_of_tinternal_filter = 3
freeze_broken_swicth = 0
board_slot_number = 4
temp_compensation_switch = 0
temp_compensation_gui_coefff = 32768

K1 = 33066
K2 = 33925
sinx_SF = 33059
dt_SF = 32973
ddt_shold = 18000
Um_derivative_merge_delay = 0
D_tune_bit_drop = 4
DAC_select_MUX = 26
anolog_PD_offset = 1100
DAC_drop_bits = 10
DAC_Uout_select = 0
health_monitor_select = 0
DAC_fine_adjust = 8200
cycle_select = 11
accum1_drop_LSB = 5
accum2_drop_LSB = 10
accum3_drop_LSB = 4
merge_al_delay = 0
outdoor_temp_time_constant = 100
electronics_temp_time_constant =1000
Um_d_dtSF = 16384
FMDE_N = 832
FMDE_multi_coeff = 1664
FMDE_comparator_B = 100

[PARAM_COMM]
data_rate = 1
sample_frenquency = 3
zero_on_alarm = 1
output1_rated_current = 1
output2_rated_current = 1
sample_delay = 1
stream_to_output_assignments = 1
start_character = 1
leader = 0
LN_name = 2
dataset_name = 254
LD_name = 0
rated_phase_current = 0
rated_neutral_point_current = 0
rated_phase_voltage = 0
rated_time_delay = 0
health_values_to_communicate = 0
status_word1 = 1
status_word2 = 0
92le_output1_selection = 0
92le_output2_selection = 1
Ch1OutSel = 0
Ch2OutSel = 0
Ch3OutSel = 0
Rated_Stream1_ch1 = 500
Ratio_Stream1_ch1 = 50000
Rated_Stream1_ch2 = 500
Ratio_Stream1_ch2 = 50000
Rated_Stream1_ch3 = 500
Ratio_Stream1_ch3 = 50000
Rated_Stream2_ch1 = 300
Ratio_Stream2_ch1 = 30000
Rated_Stream2_ch2 = 300
Ratio_Stream2_ch2 = 30000
Rated_Stream2_ch3 = 300
Ratio_Stream2_ch3 = 30000

[PARAM_GE]
;led_current_A = 103310		
;led_current_B = 65535000
;led_current_C = 2000

;tec_temperature_A = 21339
;tec_temperature_B = 69459
;tec_temperature_C = 65535000
;tec_temperature_D = 2000

;modulator_drive_A = 8500			
;modulator_drive_B = 65535000
;modulator_drive_C = 2000

;input_peak_level_A = 32768000 
;input_peak_level_B = 2000

;average_deviation_A = 213.75
;average_deviation_B = 427.5
;average_deviation_C = 65535000
;average_deviation_D = 2000

;harmonic_A = 4000
;harmonic_B = 8000
;harmonic_C = 65536000
;harmonic_D = 2000
K_LED_Current = 0.85
B_LED_Current = 0
K_TEC_Temperature = 471.75
B_KEC_Temperature = 10066.74
K_Modulator = 0.40
B_Modulator = 0
K_Input_Peak = 0.99
B_Input_Peak = 0
K_Average_Deviation = 1.53
B_Average_Deviation = -37270
K_Harmonic = 0.000468497
B_Harmonic = 16384
[PARAM_BUILD_ROOT]
fiber_turns = 20
mean_wavelength = 13136
light_source_power = 0
select_PD_resister = 0
project_serial = 1
column_serial = 1919
sensor_serial = 0
elec_serial = 17
mu_sample_frequency = 0
rsv1 = 0
number_of_boards = 1

[PARAM_FILED_SERVICE]
pd_gain_adjust = 0



`
// 按行分割数据
function parseIni(fileContent) {
    const lines = fileContent.split('\n');
    const resultMap = {}
    let currentGroupKey
    lines.forEach(item => {
        if (item.startsWith('[')) {
            currentGroupKey = item
            resultMap[item.trim()] = {}
        } else {
            if (resultMap[currentGroupKey]) {
                if (item) {
                    let key = item.split('=')[0].trim()
                    let value = item.split('=')[1]
                    if (key) {
                        // if (!value) {
                        //     console.log(`item`,item)
                        //     value = ''
                        // }
                        resultMap[currentGroupKey][key.trim()] = value.trim()
                    }
                }
            }
        }
    })
    return resultMap
}
let resultMap = parseIni(str)
try {
    fs.writeFileSync('res.js', JSON.stringify(resultMap,null,2));
    console.log(`文件 ${filePath} 写入成功！`);
  } catch (err) {
    console.error(`写入文件 ${filePath} 时出错:`, err);
  }
